﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using tmAsk.Common;

namespace tmAsk.Manager
{
    public partial class Admin_search : System.Web.UI.Page
    {
        function make_htm = new function();//继承类
        tmAsk.Data.MakehtmlSQL SQL = new tmAsk.Data.MakehtmlSQL();
        protected void Page_Load(object sender, EventArgs e)
        {
            function.CheckAdminLogin();
            string type = Request["type"];
            string keyword = Request["keyword"];
            //string sqlstr = Request["sqlstr"];
            string sqlstr = "1=1";
            if (!function.CheckNull(type))
            {
                Response.Write("<script>alert('非法操作！');window.history.go(-1);</script>");
                return;
            }


            if (type != "allClass")
                sqlstr += " and a_classid=" + type;
            if (keyword != "" && keyword != null)
                sqlstr += " and a_title like '%" + keyword + "%'";

            string html = "";
            string template_url = Request["template"];
            string html_url = Server.MapPath(template_url);

            string page = Request["page"];
            int pageindex = 1;
            if (page == null || page == "")
            {
                pageindex = 1;
            }
            else
            {
                pageindex = Convert.ToInt16(page);
            }


            html = make_htm.Get_page(html_url, "[sqlstr]", sqlstr, "&page=", pageindex, "?template=" + template_url + "&type=" + type + "&keyword=" + keyword);
            Response.Write(html);
        }
    }
}